<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>

    // 从服务器拿到很多数字
    var playCount1 = 12678
    var playCount2 = 5433322
    var playCount3 = 8766633333


    // 封装一个工具类:对数字进行格式化
    function formatCount(count){
      if (count < 100000) {
        return count
      }else if (count >= 100000 & count< 100000000) {
        return `${Math.round(count/10000)}万`
      }else if(count >= 10_0000_0000){
        return `${Math.round(count/1_0000_0000)}亿`
      }
      
    }
    console.log(formatCount(playCount1));
    console.log(formatCount(playCount2));
    console.log(formatCount(playCount3));
    
  </script>
</body>
</html>